<template>
  <!-- 登录注册表单组件 -->
  <div v-if="model" class="modal">
    <div class="content animate__animated animate__fadeInDown">
      <header>
        <slot name="title"></slot>
        <div class="cancel-btn" @click="close">
          <slot name="cancel"></slot>
        </div>
      </header>
      <slot name="modal-contain"></slot>
    </div>
  </div>
</template>

<script lang="ts" setup>
const model = defineModel({ type: Boolean, default: false })
function close() {
  model.value = false
}
</script>

<style scoped lang="scss">
.modal {
  position: fixed;
  height: 100%;
  width: 100%;
  left: 0;
  top: 0;
  z-index: 1000;
  background-color: #0000007a;
  display: flex;
  align-items: center;
  justify-content: center;


  .content {
    width: 40%;
    min-width: max-content;
    background-color: #fff;
    height: max-content;
    max-height: 600px;
    min-height: 30vh;
    border-radius: 10px;
    position: relative;
    padding: 20px;

    header {
      height: max-content;
      min-height: 30px;
      margin-bottom: 20px;
    }

    .cancel-btn {
      height: 30px;
      position: absolute;
      right: 20px;
      top: 20px;

    }
  }

  .animate__animated {
    --animate-duration: 500ms;
  }
}

:deep(.cancel-btn) {
  .iconfont {
    color: #666;
    font-size: 25px;
    cursor: pointer;

    &:hover {
      transition: all 0.5s;
      transform: scale(1.1);
    }
  }

  img {
    width: 25px;
  }
}
</style>
 